/* 
	@Copyright (c) 2007 by Denis Riabtchik. All rights reserved. See license.txt and http://jgrouse.com for details@
	$Id: Link.java 596 2013-04-13 20:38:09Z denis.riabtchik@gmail.com $
*/

package jgrouse.jgdoc.elements;

import jgrouse.jgdoc.api.IComment;
import jgrouse.jgdoc.api.ILink;

public class Link extends ContentSection implements ILink
{
	private static final long serialVersionUID = -2519240646466784423L;
	private String m_link;
	private String m_resolvedPath;
	private IComment m_comment;
	private boolean external;
	
	public boolean isExternal() {
		return external;
	}


	public void setExternal(boolean external) {
		this.external = external;
	}


	public Link(String pLink, String pContent, IComment pComment)
	{
		super(pContent);
		m_link = pLink;
		m_comment = pComment;
	}


	/* (non-Javadoc)
	 * @see jgrouse.jgdoc.elements.ILink#getLink()
	 */
	public String getLink()
	{
		return m_link;
	}

	/* (non-Javadoc)
	 * @see jgrouse.jgdoc.elements.ILink#getResolvedPath()
	 */
	public String getResolvedPath()
	{
		return m_resolvedPath;
	}

	public void setResolvedPath(String pResolvedPath)
	{
		m_resolvedPath = pResolvedPath;
	}
	
	public String toString()
	{
		if (m_resolvedPath == null)
		{
			return super.toString();
		}
		StringBuffer buf = new StringBuffer("<link name=\"").append(m_link).append("\"");
		buf.append(" external=\"").append(external).append("\"");
		buf.append(" resolvedPath=\"").append(m_resolvedPath).append("\"");
		buf.append('>').append("<![CDATA[").append(getText()).append("]]></link>");
		return buf.toString();
	}
	
	public boolean isLink()
	{
		return true;
	}


	public IComment getComment()
	{
		return m_comment;
	}
	
	
	
}
